import { NoSkinCellRenderer } from "../../common/item/NoSkinCellRenderer";
import { ObjCreate } from "../../common/ObjCreate";
import { Language } from "../../../../../extend/language/Language";
import { GlobalClass } from "../../../../../com/mui/core/GlobalClass";
import { FriendInfo } from "../../../model/FriendInfo";
import { Dispatcher } from "../../../../mvc/core/Dispatcher";
import { DataEvent } from "../../../events/DataEvent";
import { EventName } from "../../../mvc/EventName";
import { GButton } from "../../../../../com/mui/controls/GButton";
//class GangFightsInviteFriendCellRenderer
    
    export  class GangFightsInviteFriendCellRenderer extends NoSkinCellRenderer
    {
        constructor()
        {
            super();
            return;
        }

        protected /* override */ createChildren(): void
        {
            super.createChildren();
            this._tfName = ObjCreate.createTextField("", 15, 7, 100, 20, this);
            this._btnInvite = ObjCreate.createGButton(Language.getString(44428), 124, 4, 50, 22, this);
            this._btnInvite.addEventListener(flash.events.MouseEvent.CLICK, this.onClickInvite);
            return;
        }

        protected /* override */ initStyle(): void
        {
            this.setStyle("downSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("overSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("upSkin", new Object /* flash.display.Bitmap */());
            this.setStyle("selectedDownSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedOverSkin", GlobalClass.getBitmap("Friend_over"));
            this.setStyle("selectedUpSkin", GlobalClass.getBitmap("Friend_over"));
            return;
        }

        public /* override */ set data(arg1: Object)
        {
            if (typeof arg1 === "friendinfo") 
            {
                this._friendInfo = arg1 as FriendInfo;
                this.updateView();
            }
            return;
        }

        /* internal  */updateView(): void
        {
            if (this._friendInfo) 
            {
                this._tfName.text = this._friendInfo.friendPlayerInfo.playerName;
            }
            return;
        }

        /* internal  */onClickInvite(arg1: Object /* flash.events.MouseEvent */): void
        {
            if (this._friendInfo) 
            {
                Dispatcher.dispatchEvent(new DataEvent(EventName.GangFightsInviteFriend, this._friendInfo.friendPlayerInfo.entityId));
            }
            return;
        }

        /* internal */ /* var */_tfName: Object /* flash.text.TextField */;

        /* internal */ /* var */_btnInvite: GButton;

        /* internal */ /* var */_friendInfo: FriendInfo;
    }
